package com.jiawa.train.common.util;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class MemberContext {
    private static final ThreadLocal<Long> member = new ThreadLocal<>();

    public static void setMember(Long memberId) {
        member.set(memberId);
    }
    public static Long getMember() {
        try {
            return member.get();
        } catch (Exception e) {
            log.info("获取用户信息异常");
            throw new RuntimeException(e);
        }
    }
    public static void removeMember() {
        member.remove();
    }
}
